package br.odonto.entities;


import java.util.Collection;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.ForeignKey;

@ManagedBean(name="estado")
@RequestScoped
@Entity
@Table(name="estado")
public class UF {
	@Id
	@GeneratedValue
	private int id;
	@Column
	private String uf;
	@Column
	private String nome;
	@OneToMany(mappedBy="estado")
	@ForeignKey(name="FK_cidade_estado")
	@Cascade(CascadeType.ALL)
	private Collection<Cidade> cidade;
	@OneToMany(mappedBy="uf")
	@ForeignKey(name="FK_pessoa_estado")
	@Cascade(CascadeType.SAVE_UPDATE)
	private Collection<Pessoa> pessoa;
	
	public UF() {
		// TODO Auto-generated constructor stub
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getUf() {
		return uf;
	}

	public void setUf(String uf) {
		this.uf = uf;
	}

	
}
